// pages/goos_detail/index.js
Page({

      /**
       * 页面的初始数据
       */
      data: {

        isCollect:false,
        goods_detail: [],
        goods_list: [
          {
            "goods_id": 57444,
            "cat_id": 5,
            "goods_name": "海信(Hisense)LED50MU8600UC 50英寸 4K超高清智能电视 HDR超薄曲面",
            "goods_price": 6809,
            "goods_number": 100,
            "goods_weight": 100,
            "goods_introduce": "<div class=\"lazyimg\"><div moduleid=\"R0503002_2\" modulename=\"关联推荐\"><p><img data-src=\"//image.suning.cn/uimg/sop/commodity/297472958116848970954760_x.jpg?from=mobile&amp;format=80q.webp\" alt=\"\" src=\"//image.suning.cn/uimg/sop/commodity/297472958116848970954760_x.jpg?from=mobile&format=80q.webp\" width=\"100%\" height=\"auto\"></p></div><div moduleid=\"R0503002_3\" modulename=\"商品详情\"><p><img data-src=\"//image.suning.cn/uimg/sop/commodity/297472958116848970954760_x.jpg?from=mobile&amp;format=80q.webp\" alt=\"\" src=\"//image.suning.cn/uimg/sop/commodity/297472958116848970954760_x.jpg?from=mobile&format=80q.webp\" width=\"100%\" height=\"auto\"></p></div><div moduleid=\"R0503002_6\" modulename=\"安装说明\"><table style=\"width: 100%; height: auto;\">\n<tbody>\n<tr>\n<td><a href=\"https://sale.suning.com/shfw/cdaz/index.html#suning\" target=\"_blank\"><img data-src=\"https://sale.suning.com/shfw/cdazpic/images/all.jpg?from=mobile&amp;format=80q.webp\" alt=\"\" src=\"https://sale.suning.com/shfw/cdazpic/images/all.jpg?from=mobile&format=80q.webp\" width=\"100%\" height=\"auto\"></a></td>\n</tr>\n</tbody>\n</table></div></div>",
            "goods_big_logo": "http://image5.suning.cn/uimg/b2c/newcatentries/0000000000-000000000193373779_1_800x800.jpg",
            "goods_small_logo": "http://image5.suning.cn/uimg/b2c/newcatentries/0000000000-000000000193373779_1_400x400.jpg",
            "goods_state": 2,
            "is_del": "0",
            "add_time": 1516509864,
            "upd_time": 1516509864,
            "delete_time": null,
            "hot_mumber": 0,
            "is_promote": false,
            "cat_one_id": 1,
            "cat_two_id": 3,
            "cat_three_id": 5,
            "goods_cat": "1,3,5",
            "pics": [{
              "pics_id": 180132,
              "goods_id": 43985,
              "pics_big": "http://image5.suning.cn/uimg/b2c/newcatentries/0000000000-000000000193373779_1_800x800.jpg",
              "pics_mid": "http://image5.suning.cn/uimg/b2c/newcatentries/0000000000-000000000193373779_1_400x400.jpg",
              "pics_sma": "http://image5.suning.cn/uimg/b2c/newcatentries/0000000000-000000000193373779_1_200x200.jpg",
              "pics_big_url": "http://image5.suning.cn/uimg/b2c/newcatentries/0000000000-000000000193373779_1_800x800.jpg",
              "pics_mid_url": "http://image5.suning.cn/uimg/b2c/newcatentries/0000000000-000000000193373779_1_400x400.jpg",
              "pics_sma_url": "http://image5.suning.cn/uimg/b2c/newcatentries/0000000000-000000000193373779_1_200x200.jpg"
            }, {
              "pics_id": 180133,
              "goods_id": 43985,
              "pics_big": "http://image4.suning.cn/uimg/b2c/newcatentries/0000000000-000000000193373779_2_800x800.jpg",
              "pics_mid": "http://image4.suning.cn/uimg/b2c/newcatentries/0000000000-000000000193373779_2_400x400.jpg",
              "pics_sma": "http://image4.suning.cn/uimg/b2c/newcatentries/0000000000-000000000193373779_2_200x200.jpg",
              "pics_big_url": "http://image4.suning.cn/uimg/b2c/newcatentries/0000000000-000000000193373779_2_800x800.jpg",
              "pics_mid_url": "http://image4.suning.cn/uimg/b2c/newcatentries/0000000000-000000000193373779_2_400x400.jpg",
              "pics_sma_url": "http://image4.suning.cn/uimg/b2c/newcatentries/0000000000-000000000193373779_2_200x200.jpg"
            }, {
              "pics_id": 180134,
              "goods_id": 43985,
              "pics_big": "http://image3.suning.cn/uimg/b2c/newcatentries/0000000000-000000000193373779_3_800x800.jpg",
              "pics_mid": "http://image3.suning.cn/uimg/b2c/newcatentries/0000000000-000000000193373779_3_400x400.jpg",
              "pics_sma": "http://image3.suning.cn/uimg/b2c/newcatentries/0000000000-000000000193373779_3_200x200.jpg",
              "pics_big_url": "http://image3.suning.cn/uimg/b2c/newcatentries/0000000000-000000000193373779_3_800x800.jpg",
              "pics_mid_url": "http://image3.suning.cn/uimg/b2c/newcatentries/0000000000-000000000193373779_3_400x400.jpg",
              "pics_sma_url": "http://image3.suning.cn/uimg/b2c/newcatentries/0000000000-000000000193373779_3_200x200.jpg"
            }, {
              "pics_id": 180135,
              "goods_id": 43985,
              "pics_big": "http://image2.suning.cn/uimg/b2c/newcatentries/0000000000-000000000193373779_4_800x800.jpg",
              "pics_mid": "http://image2.suning.cn/uimg/b2c/newcatentries/0000000000-000000000193373779_4_400x400.jpg",
              "pics_sma": "http://image2.suning.cn/uimg/b2c/newcatentries/0000000000-000000000193373779_4_200x200.jpg",
              "pics_big_url": "http://image2.suning.cn/uimg/b2c/newcatentries/0000000000-000000000193373779_4_800x800.jpg",
              "pics_mid_url": "http://image2.suning.cn/uimg/b2c/newcatentries/0000000000-000000000193373779_4_400x400.jpg",
              "pics_sma_url": "http://image2.suning.cn/uimg/b2c/newcatentries/0000000000-000000000193373779_4_200x200.jpg"
            }, {
              "pics_id": 180136,
              "goods_id": 43985,
              "pics_big": "http://image1.suning.cn/uimg/b2c/newcatentries/0000000000-000000000193373779_5_800x800.jpg",
              "pics_mid": "http://image1.suning.cn/uimg/b2c/newcatentries/0000000000-000000000193373779_5_400x400.jpg",
              "pics_sma": "http://image1.suning.cn/uimg/b2c/newcatentries/0000000000-000000000193373779_5_200x200.jpg",
              "pics_big_url": "http://image1.suning.cn/uimg/b2c/newcatentries/0000000000-000000000193373779_5_800x800.jpg",
              "pics_mid_url": "http://image1.suning.cn/uimg/b2c/newcatentries/0000000000-000000000193373779_5_400x400.jpg",
              "pics_sma_url": "http://image1.suning.cn/uimg/b2c/newcatentries/0000000000-000000000193373779_5_200x200.jpg"
            }],
            "attrs": [{
              "goods_id": 43985,
              "attr_id": 2704,
              "attr_value": "海信彩电LED50MU8600UC",
              "add_price": 0,
              "attr_name": "主体-商品名称",
              "attr_sel": "only",
              "attr_write": "manual",
              "attr_vals": "海信电视LED55EC520UA"
            }, {
              "goods_id": 43985,
              "attr_id": 2705,
              "attr_value": "是",
              "add_price": 0,
              "attr_name": "显示-曲面",
              "attr_sel": "only",
              "attr_write": "manual",
              "attr_vals": "否"
            }, {
              "goods_id": 43985,
              "attr_id": 2706,
              "attr_value": "智能电视",
              "add_price": 0,
              "attr_name": "系统-智能电视",
              "attr_sel": "only",
              "attr_write": "manual",
              "attr_vals": "智能电视"
            }, {
              "goods_id": 43985,
              "attr_id": 2709,
              "attr_value": "160瓦特",
              "add_price": 0,
              "attr_name": "功耗-整机功率（W）",
              "attr_sel": "only",
              "attr_write": "manual",
              "attr_vals": "170瓦特"
            }, {
              "goods_id": 43985,
              "attr_id": 7173,
              "attr_value": "4K VA",
              "add_price": 0,
              "attr_name": "规格-面板类型",
              "attr_sel": "only",
              "attr_write": "manual",
              "attr_vals": "-"
            }, {
              "goods_id": 43985,
              "attr_id": 2711,
              "attr_value": "有线+无线",
              "add_price": 0,
              "attr_name": "网络-网络连接方式",
              "attr_sel": "only",
              "attr_write": "manual",
              "attr_vals": "有线+无线"
            }, {
              "goods_id": 43985,
              "attr_id": 2713,
              "attr_value": "2",
              "add_price": 0,
              "attr_name": "音频-扬声器数量",
              "attr_sel": "only",
              "attr_write": "manual",
              "attr_vals": "2"
            }, {
              "goods_id": 43985,
              "attr_id": 2714,
              "attr_value": "支持",
              "add_price": 0,
              "attr_name": "交互设备-无线键鼠",
              "attr_sel": "only",
              "attr_write": "manual",
              "attr_vals": "支持"
            }, {
              "goods_id": 43985,
              "attr_id": 2716,
              "attr_value": "产品说明书*1，遥控器*1，电源线*1，天线隔离器*1，螺钉*N",
              "add_price": 0,
              "attr_name": "包装清单-包装清单",
              "attr_sel": "only",
              "attr_write": "manual",
              "attr_vals": "产品说明书*1，遥控器*1，电源线*1，螺钉*N"
            }],
          },
          {
            "goods_id": 57442,
            "cat_id": 9,
            "goods_name": "创维彩电40G6A",
            "goods_price": 2999,
            "goods_number": 100,
            "goods_weight": 100,
            "goods_introduce": "<div class=\"lazyimg\"><p><a href=\"https://cuxiao.suning.com/hd20161212.html\" target=\"_blank\"><img data-src=\"https://image.suning.cn/uimg/sop/commodity/362052609798551643879700_x.jpg?from=mobile&amp;format=80q.webp\" alt=\"\" src=\"https://image.suning.cn/uimg/sop/commodity/362052609798551643879700_x.jpg?from=mobile&format=80q.webp\" width=\"100%\" height=\"auto\"></a></p><div moduleid=\"R0503002_3\" modulename=\"商品详情\"><p><img data-src=\"//image.suning.cn/uimg/sop/commodity/157748838012533923772745_x.jpg?from=mobile&amp;format=80q.webp\" alt=\"\" src=\"//image.suning.cn/uimg/sop/commodity/157748838012533923772745_x.jpg?from=mobile&format=80q.webp\" width=\"100%\" height=\"auto\"><img data-src=\"//image.suning.cn/uimg/sop/commodity/150028357102938624793270_x.jpg?from=mobile&amp;format=80q.webp\" alt=\"\" src=\"//image.suning.cn/uimg/sop/commodity/150028357102938624793270_x.jpg?from=mobile&format=80q.webp\" width=\"100%\" height=\"auto\"><img data-src=\"//image.suning.cn/uimg/sop/commodity/220977467571085347226000_x.jpg?from=mobile&amp;format=80q.webp\" alt=\"\" src=\"//image.suning.cn/uimg/sop/commodity/220977467571085347226000_x.jpg?from=mobile&format=80q.webp\" width=\"100%\" height=\"auto\"><img data-src=\"//image.suning.cn/uimg/sop/commodity/228081149112443534549350_x.jpg?from=mobile&amp;format=80q.webp\" alt=\"\" src=\"//image.suning.cn/uimg/sop/commodity/228081149112443534549350_x.jpg?from=mobile&format=80q.webp\" width=\"100%\" height=\"auto\"><img data-src=\"//image.suning.cn/uimg/sop/commodity/919800420137331965577070_x.jpg?from=mobile&amp;format=80q.webp\" alt=\"\" src=\"//image.suning.cn/uimg/sop/commodity/919800420137331965577070_x.jpg?from=mobile&format=80q.webp\" width=\"100%\" height=\"auto\"><img data-src=\"//image.suning.cn/uimg/sop/commodity/662322495818557767591200_x.jpg?from=mobile&amp;format=80q.webp\" alt=\"\" src=\"//image.suning.cn/uimg/sop/commodity/662322495818557767591200_x.jpg?from=mobile&format=80q.webp\" width=\"100%\" height=\"auto\"><img data-src=\"//image.suning.cn/uimg/sop/commodity/586957695182492580929000_x.jpg?from=mobile&amp;format=80q.webp\" alt=\"\" src=\"//image.suning.cn/uimg/sop/commodity/586957695182492580929000_x.jpg?from=mobile&format=80q.webp\" width=\"100%\" height=\"auto\"><img data-src=\"//image.suning.cn/uimg/sop/commodity/200725374271664362332210_x.jpg?from=mobile&amp;format=80q.webp\" alt=\"\" src=\"//image.suning.cn/uimg/sop/commodity/200725374271664362332210_x.jpg?from=mobile&format=80q.webp\" width=\"100%\" height=\"auto\"></p></div><div moduleid=\"R0503002_2\" modulename=\"关联推荐\"><p>1</p></div><div moduleid=\"R0503002_6\" modulename=\"安装说明\"><table style=\"width: 100%; height: auto;\">\n<tbody>\n<tr>\n<td><a href=\"https://sale.suning.com/shfw/cdaz/index.html#suning\" target=\"_blank\"><img data-src=\"https://sale.suning.com/shfw/cdazpic/images/all.jpg?from=mobile&amp;format=80q.webp\" alt=\"\" src=\"https://sale.suning.com/shfw/cdazpic/images/all.jpg?from=mobile&format=80q.webp\" width=\"100%\" height=\"auto\"></a></td>\n</tr>\n</tbody>\n</table></div></div>",
            "goods_big_logo": "http://image1.suning.cn/uimg/b2c/newcatentries/0000000000-000000000601395527_1_800x800.jpg",
            "goods_small_logo": "http://image1.suning.cn/uimg/b2c/newcatentries/0000000000-000000000601395527_1_400x400.jpg",
            "goods_state": 2,
            "is_del": "0",
            "add_time": 1516663277,
            "upd_time": 1516663277,
            "delete_time": null,
            "hot_mumber": 0,
            "is_promote": false,
            "cat_one_id": 1,
            "cat_two_id": 3,
            "cat_three_id": 9,
            "goods_cat": "1,3,9",
            "pics": [{
              "pics_id": 235229,
              "goods_id": 57442,
              "pics_big": "http://image1.suning.cn/uimg/b2c/newcatentries/0000000000-000000000601395527_1_800x800.jpg",
              "pics_mid": "http://image1.suning.cn/uimg/b2c/newcatentries/0000000000-000000000601395527_1_400x400.jpg",
              "pics_sma": "http://image1.suning.cn/uimg/b2c/newcatentries/0000000000-000000000601395527_1_200x200.jpg",
              "pics_big_url": "http://image1.suning.cn/uimg/b2c/newcatentries/0000000000-000000000601395527_1_800x800.jpg",
              "pics_mid_url": "http://image1.suning.cn/uimg/b2c/newcatentries/0000000000-000000000601395527_1_400x400.jpg",
              "pics_sma_url": "http://image1.suning.cn/uimg/b2c/newcatentries/0000000000-000000000601395527_1_200x200.jpg"
            }, {
              "pics_id": 235230,
              "goods_id": 57442,
              "pics_big": "http://image5.suning.cn/uimg/b2c/newcatentries/0000000000-000000000601395527_2_800x800.jpg",
              "pics_mid": "http://image5.suning.cn/uimg/b2c/newcatentries/0000000000-000000000601395527_2_400x400.jpg",
              "pics_sma": "http://image5.suning.cn/uimg/b2c/newcatentries/0000000000-000000000601395527_2_200x200.jpg",
              "pics_big_url": "http://image5.suning.cn/uimg/b2c/newcatentries/0000000000-000000000601395527_2_800x800.jpg",
              "pics_mid_url": "http://image5.suning.cn/uimg/b2c/newcatentries/0000000000-000000000601395527_2_400x400.jpg",
              "pics_sma_url": "http://image5.suning.cn/uimg/b2c/newcatentries/0000000000-000000000601395527_2_200x200.jpg"
            }, {
              "pics_id": 235231,
              "goods_id": 57442,
              "pics_big": "http://image4.suning.cn/uimg/b2c/newcatentries/0000000000-000000000601395527_3_800x800.jpg",
              "pics_mid": "http://image4.suning.cn/uimg/b2c/newcatentries/0000000000-000000000601395527_3_400x400.jpg",
              "pics_sma": "http://image4.suning.cn/uimg/b2c/newcatentries/0000000000-000000000601395527_3_200x200.jpg",
              "pics_big_url": "http://image4.suning.cn/uimg/b2c/newcatentries/0000000000-000000000601395527_3_800x800.jpg",
              "pics_mid_url": "http://image4.suning.cn/uimg/b2c/newcatentries/0000000000-000000000601395527_3_400x400.jpg",
              "pics_sma_url": "http://image4.suning.cn/uimg/b2c/newcatentries/0000000000-000000000601395527_3_200x200.jpg"
            }, {
              "pics_id": 235232,
              "goods_id": 57442,
              "pics_big": "http://image3.suning.cn/uimg/b2c/newcatentries/0000000000-000000000601395527_4_800x800.jpg",
              "pics_mid": "http://image3.suning.cn/uimg/b2c/newcatentries/0000000000-000000000601395527_4_400x400.jpg",
              "pics_sma": "http://image3.suning.cn/uimg/b2c/newcatentries/0000000000-000000000601395527_4_200x200.jpg",
              "pics_big_url": "http://image3.suning.cn/uimg/b2c/newcatentries/0000000000-000000000601395527_4_800x800.jpg",
              "pics_mid_url": "http://image3.suning.cn/uimg/b2c/newcatentries/0000000000-000000000601395527_4_400x400.jpg",
              "pics_sma_url": "http://image3.suning.cn/uimg/b2c/newcatentries/0000000000-000000000601395527_4_200x200.jpg"
            }, {
              "pics_id": 235233,
              "goods_id": 57442,
              "pics_big": "http://image2.suning.cn/uimg/b2c/newcatentries/0000000000-000000000601395527_5_800x800.jpg",
              "pics_mid": "http://image2.suning.cn/uimg/b2c/newcatentries/0000000000-000000000601395527_5_400x400.jpg",
              "pics_sma": "http://image2.suning.cn/uimg/b2c/newcatentries/0000000000-000000000601395527_5_200x200.jpg",
              "pics_big_url": "http://image2.suning.cn/uimg/b2c/newcatentries/0000000000-000000000601395527_5_800x800.jpg",
              "pics_mid_url": "http://image2.suning.cn/uimg/b2c/newcatentries/0000000000-000000000601395527_5_400x400.jpg",
              "pics_sma_url": "http://image2.suning.cn/uimg/b2c/newcatentries/0000000000-000000000601395527_5_200x200.jpg"
            }],
            "attrs": [{
              "goods_id": 57442,
              "attr_id": 8540,
              "attr_value": "创维彩电40G6A",
              "add_price": 0,
              "attr_name": "主体-商品名称",
              "attr_sel": "only",
              "attr_write": "manual",
              "attr_vals": "创维电视60V8E"
            }, {
              "goods_id": 57442,
              "attr_id": 8541,
              "attr_value": "否",
              "add_price": 0,
              "attr_name": "显示-曲面",
              "attr_sel": "only",
              "attr_write": "manual",
              "attr_vals": "否"
            }, {
              "goods_id": 57442,
              "attr_id": 8542,
              "attr_value": "智能电视",
              "add_price": 0,
              "attr_name": "系统-智能电视",
              "attr_sel": "only",
              "attr_write": "manual",
              "attr_vals": "智能电视"
            }, {
              "goods_id": 57442,
              "attr_id": 8548,
              "attr_value": "金属",
              "add_price": 0,
              "attr_name": "外观-边框材质",
              "attr_sel": "only",
              "attr_write": "manual",
              "attr_vals": "金属"
            }, {
              "goods_id": 57442,
              "attr_id": 8549,
              "attr_value": "AVI,MP4,RM,RMVB",
              "add_price": 0,
              "attr_name": "USB支持格式-USB支持视频格式",
              "attr_sel": "only",
              "attr_write": "manual",
              "attr_vals": "AVI,MP4,RM,RMVB"
            }, {
              "goods_id": 57442,
              "attr_id": 8543,
              "attr_value": "74瓦特",
              "add_price": 0,
              "attr_name": "功耗-整机功率（W）",
              "attr_sel": "only",
              "attr_write": "manual",
              "attr_vals": "160瓦特"
            }, {
              "goods_id": 57442,
              "attr_id": 8550,
              "attr_value": "899*205*553毫米",
              "add_price": 0,
              "attr_name": "规格-含底座尺寸（宽*高*",
              "attr_sel": "only",
              "attr_write": "manual",
              "attr_vals": "1450*899*305毫米"
            }, {
              "goods_id": 57442,
              "attr_id": 16546,
              "attr_value": "2个",
              "add_price": 0,
              "attr_name": "端口-HDMI1.4接口",
              "attr_sel": "only",
              "attr_write": "manual",
              "attr_vals": "1个"
            }, {
              "goods_id": 57442,
              "attr_id": 8557,
              "attr_value": "Dolby",
              "add_price": 0,
              "attr_name": "音频-音频技术",
              "attr_sel": "only",
              "attr_write": "manual",
              "attr_vals": "Dolby,DTS"
            }, {
              "goods_id": 57442,
              "attr_id": 8554,
              "attr_value": "支持",
              "add_price": 0,
              "attr_name": "互联互通-WIFI",
              "attr_sel": "only",
              "attr_write": "manual",
              "attr_vals": "支持"
            }]
          }]
          },
          GoodsInfo: {},
          /**
           * 生命周期函数--监听页面加载
           */
          onLoad: function (options) {
            const {
              goods_id
            } = options;
            console.log(goods_id);
            this.getGoodsDetail(goods_id);
          },


          async getGoodsDetail(goods_id) {
              // 通过url获取信息
              // const res = await request({URL:"/goods.detail",data:{goods_id}});
              let goods_detail;
              if(goods_id==57444){
                  goods_detail = this.data.goods_list[0];
              }else{
                  goods_detail = this.data.goods_list[1];
              }
              this.GoodsInfo = goods_detail;
              this.setData({
                //优化渲染，删除不需要的数据
                goods_detail: {
                  goods_id: goods_detail.goods_id,
                  goods_name: goods_detail.goods_name,
                  goods_price: goods_detail.goods_price,
                  goods_introduce: goods_detail.goods_introduce.replace(/\.webp/g, '.jpg'),
                  pics: goods_detail.pics
                }
              })
            },

            handlePrevewImage(e) {
              const urls = this.GoodsInfo.pics.map(v => v.pics_mid);
              const current = e.currentTarget.dataset.url;
              wx.previewImage({
                current,
                urls
              })
            },

            //点击购物车
            handleCartAdd() {
              let cart = wx.getStorageSync('cart') || [];
              //判断商品是否存在
              let index = cart.findIndex(v => v.goods_id === this.GoodsInfo.goods_id);
              if (index === -1) {
                //不存在
                this.GoodsInfo.num = 1;
                this.GoodsInfo.checked = true;
                cart.push(this.GoodsInfo);
              } else {
                //存在
                cart[index].num++;
              }

              //重新添加到缓存
              wx.setStorageSync('cart', cart);
              //弹出提示
              wx.showToast({
                title: '加入成功',
                icon: 'success',
                //防止多次点击
                mask: true
              })
            },
            /**
             * 生命周期函数--监听页面初次渲染完成
             */
            onReady: function () {

            },

            /**
             * 生命周期函数--监听页面显示
             */
            onShow: function () {
              //获取前一页的数据
                let pages = getCurentPages();
                let currentPage = pages[pages.length-1];
                let options = currentPage.options;
                const {goods_id} = options;
                this.getGoodsDetail(goods_id);

                //1、获取缓存中收藏的数组
                let collect = wx.getStorageSync("collect")||[];
                let isCollect = collect.some(v=>v.goods_id===this.GoodsInfo.goods_id);
                this.setData({
                  //优化渲染，删除不需要的数据
                  goods_detail: {
                    goods_id: goods_detail.goods_id,
                    goods_name: goods_detail.goods_name,
                    goods_price: goods_detail.goods_price,
                    goods_introduce: goods_detail.goods_introduce.replace(/\.webp/g, '.jpg'),
                    pics: goods_detail.pics
                  },
                  isCollect
                })
            },

            //点击收藏
            handleCollect(){
              let isCollect = false;
              //获取缓存数组
              let collect = wx.getStorageSync("collect")||[];

              let index = collect.findIndex(v=>v.goods_id===this.GoodsInfo.goods_id);

              if(index!==-1){
                //能找到
                collect.splice(index,1);
                isCollect = false;
                wx-wx.showToast({
                  title: '取消成功',
                  icon: 'success',
                  mask: true,
                });
              }else{
                collect.push(this.GoodsInfo);
                isCollect = true;
                wx-wx.showToast({
                  title: '收藏成功',
                  icon: 'success',
                  mask: true,
                });
              }

              wx.setStorageSync("collect", collect);
              this.setData({
                isCollect
              })
            },

            /**
             * 生命周期函数--监听页面隐藏
             */
            onHide: function () {

            },

            /**
             * 生命周期函数--监听页面卸载
             */
            onUnload: function () {

            },

            /**
             * 页面相关事件处理函数--监听用户下拉动作
             */
            onPullDownRefresh: function () {

            },

            /**
             * 页面上拉触底事件的处理函数
             */
            onReachBottom: function () {

            },

            /**
             * 用户点击右上角分享
             */
            onShareAppMessage: function () {

            }
        })